home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / addVisorFolders.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  11.4 KB  |  399 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  April 10, 1998
  22. //  Author:         Ed Millard
  23. //
  24. //  Description:
  25. //      This script adds the default folders to a visor panel
  26. //
  27. //  Input Arguments:
  28. //      visor editor
  29. //
  30. //  Return Value:
  31. //      None.
  32. //
  33.  
  34.  
  35. //
  36. // visor animation folder commands for filtering clip and pose nodes
  37. //
  38.  
  39. global proc string[]
  40. getLibraryPoses()
  41. //
  42. // return list of poses not currently attached to any character
  43. //
  44. {
  45.     string $library[];
  46.     string $poses[]  = `pose -q -allPoses`;
  47.     int $n = 0;
  48.     int $nposes = size($poses);
  49.     for ($i=0; $i < $nposes; $i++)
  50.     {    
  51.         string $characters[] = `clip -q -ch $poses[$i]`;
  52.         if (size($characters) == 0) $library[$n++] = $poses[$i];
  53.     }
  54.     return $library;
  55. }
  56.  
  57. global proc string[]
  58. getLibraryClips()
  59. //
  60. // return list of clips not currently attached to any character
  61. //
  62. {
  63.       string $library[];
  64.       string $clips[]  = `clip -q -allSourceClips`;
  65.       int $n = 0;
  66.       int $nclips = size($clips);
  67.       for ($i=0; $i < $nclips; $i++)
  68.       {
  69.         string $characters[] = `clip -q -ch $clips[$i]`;
  70.         if (size($characters) == 0) $library[$n++] = $clips[$i];
  71.       }
  72.       return $library;
  73. }
  74.  
  75. global proc string[]
  76. getAllCharacterClips()
  77. //
  78. // return list of clips  attached to any character
  79. //
  80. {
  81.       string $library[];
  82.       string $clips[]  = `clip -q -allSourceClips`;
  83.       int $n = 0;
  84.       int $nclips = size($clips);
  85.       for ($i=0; $i < $nclips; $i++)
  86.       {
  87.         string $characters[] = `clip -q -ch $clips[$i]`;
  88.         if (size($characters) > 0) $library[$n++] = $clips[$i];
  89.       }
  90.       return $library;
  91. }
  92.  
  93. global proc string[]
  94. getAllCharacterPoses()
  95. //
  96. // return list of poses attached to any character
  97. //
  98. {
  99.     string $library[];
  100.     string $poses[]  = `pose -q -allPoses`;
  101.     int $n = 0;
  102.     int $nposes = size($poses);
  103.     for ($i=0; $i < $nposes; $i++)
  104.     {    
  105.         string $characters[] = `clip -q -ch $poses[$i]`;
  106.         if (size($characters) > 0) $library[$n++] = $poses[$i];
  107.     }
  108.     return $library;
  109. }
  110.  
  111. global proc string[]
  112. getCharacterClips()
  113. //
  114. // return list of clips attached to current character(s)
  115. //
  116. {
  117.     string $allClips[];
  118.     string $characters[] = `currentCharacters`;
  119.     int $n=0;
  120.     int $nchars = size($characters);
  121.  
  122.     if ($nchars == 0) return `getAllCharacterClips`;
  123.  
  124.     for ($i=0; $i < $nchars; $i++)
  125.     {
  126.         string $clips[] = `clip -q -n $characters[$i]`;
  127.         for ($j=0; $j < size($clips); $j++)
  128.             $allClips[$n++] = $clips[$j];
  129.     }
  130.     return $allClips;
  131. }
  132.  
  133. global proc string[]
  134. getCharacterPoses()
  135. //
  136. // return list of poses attached to current character(s)
  137. //
  138. {
  139.     string $allPoses[];
  140.     string $characters[] = `currentCharacters`;
  141.     int $n=0;
  142.     int $nchars = size($characters);
  143.  
  144.     if ($nchars == 0) return `getAllCharacterPoses`;
  145.  
  146.     for ($i=0; $i < $nchars; $i++)
  147.     {
  148.         string $poses[] = `pose -q -n $characters[$i]`;
  149.         for ($j=0; $j < size($poses); $j++)
  150.             $allPoses[$n++] = $poses[$j];
  151.     }
  152.     return $allPoses;
  153. }
  154.  
  155.  
  156.  
  157. global proc
  158. addVisorFolders(string $visorEd)
  159. {
  160.     visor -reset $visorEd;
  161.  
  162.     int $isHyperShade;
  163.     if($visorEd == "hyperShadePanel1VisorEd") {
  164.         $isHyperShade = 1;
  165.     }else{
  166.         $isHyperShade = 0;
  167.     }
  168.  
  169.     // Animation Nodes Folder 
  170.     //
  171.     visor -addFolder -name "Animation"
  172.         -openDirectories 1
  173.         $visorEd;
  174.       visor -addFolder -name "Character Clips & Poses" -parent "Animation" 
  175.           -type command -cmd "currentCharacters"
  176.           $visorEd;
  177.       visor -addFolder -name "Clips" -parent "Animation/Character Clips & Poses"
  178.           -type command -cmd "getCharacterClips"
  179.           $visorEd;
  180.       visor -addFolder -name "Poses" -parent "Animation/Character Clips & Poses"
  181.           -type command -cmd "getCharacterPoses"
  182.           $visorEd;
  183.       if (`about -mac`) 
  184.       {
  185.       visor -addFolder -name "Unused Clips & Poses" -parent "Animation" 
  186.           -type command -cmd "currentCharacters"
  187.           $visorEd;
  188.       }
  189.       else
  190.       {
  191.       visor -addFolder -name "Unused Clips & Poses" -parent "Animation" 
  192.           $visorEd;
  193.       }
  194.       visor -addFolder -name "Clips" -parent "Animation/Unused Clips & Poses"
  195.           -type command -cmd "getLibraryClips"
  196.           $visorEd;
  197.       visor -addFolder -name "Poses" -parent "Animation/Unused Clips & Poses"
  198.           -type command -cmd "getLibraryPoses"
  199.           $visorEd;
  200.  
  201.     // Rendering Nodes Folder 
  202.     //
  203.     visor -addFolder -name "Rendering"
  204.                 -openDirectories 1 $visorEd;
  205.       visor -addFolder -name "Cameras" -parent "Rendering"
  206.                 -type command -cmd "ls -type camera -type imagePlane"
  207.                 $visorEd;
  208.       visor -addFolder -name "Lights" -parent "Rendering"
  209.                 -type command -cmd "ls -type light"
  210.                 $visorEd;
  211.       visor -addFolder -name "Materials" -parent "Rendering"
  212.                 -type connectedNodes -openFolder 1 -cmd "ls -type defaultShaderList"
  213.                 $visorEd;
  214.       visor -addFolder -name "Post Process" -parent "Rendering"
  215.                 -type command -cmd "ls -type opticalFX -type shaderGlow"
  216.                 $visorEd;
  217.       visor -addFolder -name "Textures" -parent "Rendering"
  218.                 -type connectedNodes -openFolder 1 -cmd "ls -type defaultTextureList"
  219.                 $visorEd;
  220.       visor -addFolder -name "Utilities" -parent "Rendering"
  221.                 -type connectedNodes -cmd "ls -type defaultRenderUtilityList"
  222.                 $visorEd;
  223.  
  224.  
  225.     /*
  226.     // The Scene folder and the User Defined folder are disabled until we
  227.     // decide exactly how they are intended to work. (jdc rendering)
  228.     //
  229.     if (`isTrue MayaCreatorExists` && (`licenseCheck -m "edit" -typ "particlePaint"`)) {
  230.         // Scene Nodes Folder 
  231.         //
  232.         visor -addFolder -name "Scene" $visorEd;
  233.  
  234.           // Scene/Deformers
  235.           //
  236.           visor -addFolder -name "Deformers" -parent "Scene" $visorEd;
  237.             visor -addFolder -name "Blend Shapes" -parent "Scene/Deformers"
  238.                     -type command -cmd "ls -type blendShape"
  239.                     $visorEd;
  240.             visor -addFolder -name "Clusters" -parent "Scene/Deformers"
  241.                     -type command -cmd "ls -type cluster"
  242.                     $visorEd;
  243.             visor -addFolder -name "Lattices" -parent "Scene/Deformers"
  244.                     -type command -cmd "ls -type lattice"
  245.                     $visorEd;
  246.             visor -addFolder -name "Sculpt Objects" -parent "Scene/Deformers"
  247.                     -type command -cmd "ls -type sculpt"
  248.                     $visorEd;
  249.             visor -addFolder -name "Wires" -parent "Scene/Deformers"
  250.                     -type command -cmd "ls -type wire"
  251.                     $visorEd;
  252.  
  253.           // Scene/Dynamics
  254.           //
  255.           visor -addFolder -name "Dynamics" -parent "Scene" $visorEd;
  256.             visor -addFolder -name "Emitters" -parent "Scene/Dynamics"
  257.                     -type command -cmd "ls -type pointEmitter"
  258.                     $visorEd;
  259.             visor -addFolder -name "Particles" -parent "Scene/Dynamics"
  260.                     -type command -cmd "ls -type particle"
  261.                     $visorEd;
  262.             visor -addFolder -name "Rigid Bodies" -parent "Scene/Dynamics"
  263.                     -type command -cmd "ls -type rigidBody"
  264.                     $visorEd;
  265.             visor -addFolder -name "Rigid Constraints" -parent "Scene/Dynamics"
  266.                     -type command -cmd "ls -type rigidConstraint"
  267.                     $visorEd;
  268.  
  269.           // Scene/Geometry
  270.           //
  271.           visor -addFolder -name "Geometry" -parent "Scene" $visorEd;
  272.             visor -addFolder -name "NURBS Curves" -parent "Scene/Geometry"
  273.                     -type command -cmd "ls -type nurbsCurve"
  274.                     $visorEd;
  275.             visor -addFolder -name "NURBS Surface" -parent "Scene/Geometry"
  276.                     -type command -cmd "ls -type nurbsSurface"
  277.                     $visorEd;
  278.             visor -addFolder -name "Polys" -parent "Scene/Geometry"
  279.                     -type command -cmd "ls -type mesh"
  280.                     $visorEd;
  281.             visor -addFolder -name "Transforms" -parent "Scene/Geometry"
  282.                     -type command -cmd "ls -type transform"
  283.                     $visorEd;
  284.  
  285.           // Scene/IK
  286.           //
  287.           visor -addFolder -name "IK" -parent "Scene" $visorEd;
  288.             visor -addFolder -name "Effectors" -parent "Scene/IK"
  289.                     -type command -cmd "ls -type ikEffector"
  290.                     $visorEd;
  291.             visor -addFolder -name "Handles" -parent "Scene/IK"
  292.                     -type command -cmd "ls -type ikHandle"
  293.                     $visorEd;
  294.             visor -addFolder -name "Joints" -parent "Scene/IK"
  295.                     -type command -cmd "ls -type joint"
  296.                     $visorEd;
  297.  
  298.         // User Defined Folders
  299.         //
  300.         visor -addFolder -name "User Defined" $visorEd;
  301.     }
  302.     */
  303.  
  304.     // Create Nodes Folder 
  305.     //
  306.     visor -addFolder -name "Create" -openDirectories 1 $visorEd;
  307.       visor -addFolder -name "Cameras" -parent "Create"
  308.                 -type defaultNodes -cmd "cameraCreateFolder()"
  309.                 $visorEd;
  310.       visor -addFolder -name "Lights" -parent "Create"
  311.                 -type defaultNodes -cmd "listNodeTypes light"
  312.                 $visorEd;
  313.       visor -addFolder -name "Materials" -parent "Create" 
  314.                 -openFolder $isHyperShade
  315.                 -type defaultNodes -cmd "listNodeTypes \"shader/surface\""
  316.                 $visorEd;
  317.         visor -addFolder -name "Volume" -parent "Create/Materials"
  318.                 -type defaultNodes -cmd "listNodeTypes \"shader/volume\""
  319.                 $visorEd;
  320.       visor -addFolder -name "Post Process" -parent "Create"
  321.                 -type defaultNodes -cmd "postProcessCreateFolder()"
  322.                 $visorEd;
  323.       visor -addFolder -name "Textures" -parent "Create"
  324.                 -openFolder $isHyperShade
  325.                 -type defaultNodes -cmd "listNodeTypes texture"
  326.                 $visorEd;
  327.       if (`about -mac`)
  328.       {
  329.         visor -addFolder -name "Utilities" -parent "Create" 
  330.         -type defaultNodes -cmd ""$visorEd;
  331.       }
  332.       else
  333.       {
  334.         visor -addFolder -name "Utilities" -parent "Create"$visorEd;
  335.       }
  336.       
  337.         visor -addFolder -name "Color" -parent "Create/Utilities"
  338.                 -type defaultNodes -cmd "listNodeTypes \"utility/color\""
  339.                 $visorEd;
  340.         visor -addFolder -name "General" -parent "Create/Utilities"
  341.                 -type defaultNodes -cmd "listNodeTypes \"utility/general\""
  342.                 $visorEd;
  343.         visor -addFolder -name "Particle" -parent "Create/Utilities"
  344.                 -type defaultNodes -cmd "listNodeTypes \"utility/particle\""
  345.                 $visorEd;
  346.         visor -addFolder -name "Switch" -parent "Create/Utilities"
  347.                 -type defaultNodes -cmd "listNodeTypes \"utility/switch\""
  348.                 $visorEd;
  349.  
  350.     // Project directory
  351.     //
  352.     visor 
  353.         -addFolder 
  354.         -openDirectories 1
  355.         -type directoryCommand 
  356.         -cmd "currentProjectParentDir()"
  357.         -name "Project"
  358.         $visorEd;
  359.  
  360.     if (`isTrue MayaCreatorExists` && (`licenseCheck -m "edit" -typ "particlePaint"`)) {
  361.         string $runTimeDir = `getenv "MAYA_LOCATION"`;
  362.         if ($runTimeDir != "") {
  363.             string $brushDir = ($runTimeDir + "/brushes");
  364.             visor 
  365.                 -addFolder 
  366.                 -name "Brushes" 
  367.                 -menu "CreatorShelf"
  368.                 -type shelfItems 
  369.                 -cmd $brushDir
  370.                 $visorEd;
  371.         }
  372.     }
  373.  
  374.     // Custom disk folders
  375.     //
  376.     // Get from an optionVar the list of directories for which custom disk 
  377.     // folders are to be created. Create a folder for each.
  378.     //
  379.     if (`optionVar -exists visorCustomDiskFolders`)
  380.     {
  381.         int     $i;
  382.         string     $customFolderNameArray[];
  383.  
  384.         $customFolderNameArray = `optionVar -query visorCustomDiskFolders`;
  385.  
  386.         for ($i = 0; $i < size($customFolderNameArray); $i++)
  387.         {
  388.             visor
  389.                 -addFolder 
  390.                 -type directory
  391.                 -openFolder true
  392.                 -path $customFolderNameArray[$i] 
  393.                 -name $customFolderNameArray[$i]
  394.                 $visorEd;
  395.         }
  396.     }
  397. }
  398.  
  399.